package com.cskaoyan.service.userserviceimpl;

import com.cskaoyan.bean.pojo.User;
import com.cskaoyan.dao.UserDao;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: lds
 * @clsss: UserServiceImpl
 * @description:
 */
@SuppressWarnings("all")
@Service
public class UserServiceImpl implements UserService {


    @Autowired
    UserDao userDao;

    @Override
    public User selectUser(User user) {
        return userDao.selectUserById(user);
    }

    @Override

    public void deleteUserById(Integer id) {
        userDao.deleteUserById(id);}

    public Integer addUserYfs(User user) {

        Integer count=userDao.insertUserServiceYfs(user);

        return count;

    }

    @Override
    public Integer checkUser(User user) {
        Integer integer = null;
        try {
            integer = userDao.selectUsers(user);
        } catch (Exception e) {
            return 404;
        }
        return integer;
    }


    @Override
    public User queryOneUser(Integer id) {
        return userDao.selectOneUser(id);
    }


    @Transactional(rollbackFor = Exception.class)
    @Override
    public User query666ById(int id) {
        return userDao.select666UserById(id);

    }

    @Override
    public User selectUserById(Integer id) {
        User user = userDao.selectUserById(id);
        return user;

    }
}
